//
//  UIBarButtonItem+XMGBarButtonItem.m
//  百思不得姐
//
//  Created by Alex on 16/7/1.
//  Copyright © 2016年 蓝鸥科技有限公司西安分公司. All rights reserved.
//

#import "UIBarButtonItem+XMGBarButtonItem.h"

@implementation UIBarButtonItem (XMGBarButtonItem)

+ (instancetype)itemWithImage:(NSString *)image hightImage:(NSString *)hightimage target:(id)target action:(SEL)action {
    
    UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
    [Button setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [Button setBackgroundImage:[UIImage imageNamed:hightimage] forState:UIControlStateHighlighted];
    
    Button.size = Button.currentBackgroundImage.size;
    [Button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[self alloc]initWithCustomView:Button];
    
}

@end
